package com.syni.mdd.yhd.common.all.dto.requestDto.marketing;

import com.syni.mdd.yhd.common.all.dto.requestDto.BaseReDto;
import com.syni.mdd.sjb.common.component.utils.common.utils.DateTimeUtils;
import com.syni.mdd.yhd.common.all.validationGroup.GroupInsert;
import lombok.Data;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;

/**
 * @className MarketActivityReDto
 * @description TOO
 * @Author cfx
 * @DATE 2019/9/2 16:43
 * @VERSION 1.0
 **/
@Data
public class MarketActivityReDto extends BaseReDto {
    @NotNull(groups = GroupInsert.class)
    @Size(max = 128,groups = GroupInsert.class)
    private String activityName;

    @NotNull(groups = GroupInsert.class)
    @Size(max = 255,groups = GroupInsert.class)
    private String activityImg;

    @NotNull(groups = GroupInsert.class)
    @Size(max = 128,groups = GroupInsert.class)
    private String activityLink;

    @NotNull(groups = GroupInsert.class)
    private String startTimestamp;

    @NotNull(groups = GroupInsert.class)
    private String endTimestamp;

    private Date startTime;

    private Date endTime;

    public void setStartTimestamp(String startTimestamp) {
        this.startTimestamp = startTimestamp;
        this.startTime = DateTimeUtils.converLongToDate(Integer.parseInt(startTimestamp) * 1000L);
    }

    public void setEndTimestamp(String endTimestamp) {
        this.endTimestamp = endTimestamp;
        this.endTime = DateTimeUtils.converLongToDate(Integer.parseInt(endTimestamp) * 1000L);
    }
}
